package com.micro.ai.template.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.time.LocalDateTime;
import java.util.Map;

/**
 * 模板版本实体
 *
 * @author micro-ai
 * @since 0.0.1
 */
@Data
@TableName(value = "template_versions", autoResultMap = true)
@Schema(description = "模板版本实体")
public class TemplateVersion {

    @TableId(value = "id", type = IdType.ASSIGN_ID)
    @Schema(description = "主键ID")
    private String id;

    @TableField("template_id")
    @Schema(description = "模板ID")
    private String templateId;

    @TableField("version")
    @Schema(description = "版本号", example = "1.0.0")
    private String version;

    @TableField("version_description")
    @Schema(description = "版本描述")
    private String versionDescription;

    @TableField("base_system_prompt")
    @Schema(description = "基础系统提示词")
    private String baseSystemPrompt;

    @TableField("base_prompt_template")
    @Schema(description = "基础提示词模板")
    private String basePromptTemplate;

    @TableField(value = "input_schema", typeHandler = JacksonTypeHandler.class)
    @Schema(description = "输入Schema")
    private Map<String, Object> inputSchema;

    @TableField(value = "output_schema", typeHandler = JacksonTypeHandler.class)
    @Schema(description = "输出Schema")
    private Map<String, Object> outputSchema;

    @TableField(value = "config_schema", typeHandler = JacksonTypeHandler.class)
    @Schema(description = "配置Schema")
    private Map<String, Object> configSchema;

    @TableField(value = "default_parameters", typeHandler = JacksonTypeHandler.class)
    @Schema(description = "默认参数")
    private Map<String, Object> defaultParameters;

    @TableField(value = "default_ollama_options", typeHandler = JacksonTypeHandler.class)
    @Schema(description = "默认Ollama选项")
    private Map<String, Object> defaultOllamaOptions;

    @TableField(value = "capabilities", typeHandler = JacksonTypeHandler.class)
    @Schema(description = "能力列表")
    private java.util.List<String> capabilities;

    @TableField(value = "dependencies", typeHandler = JacksonTypeHandler.class)
    @Schema(description = "依赖项")
    private Map<String, Object> dependencies;

    @TableField(value = "metadata", typeHandler = JacksonTypeHandler.class)
    @Schema(description = "元数据")
    private Map<String, Object> metadata;

    @TableField(value = "changelog", typeHandler = JacksonTypeHandler.class)
    @Schema(description = "变更日志")
    private Map<String, Object> changelog;

    @TableField("is_active")
    @Schema(description = "是否活跃版本")
    private Boolean isActive;

    @TableField("is_stable")
    @Schema(description = "是否稳定版本")
    private Boolean isStable;

    @TableField("release_notes")
    @Schema(description = "发布说明")
    private String releaseNotes;

    @TableField("created_at")
    @Schema(description = "创建时间")
    private LocalDateTime createdAt;
}
